package com.test.demo.utils

import android.os.Bundle
import android.view.View
import com.test.demo.R
import com.test.demo.base.BaseActivity
import com.test.demo.databinding.DialogVideoBinding
import com.test.demo.utils.data.ConstUtils
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel

/**
 * 视频播放
 */
class VideoPlayActivity : BaseActivity<BaseViewModel, DialogVideoBinding>() {

    override fun layoutId(): Int {
        return R.layout.dialog_video
    }

    override fun initView(savedInstanceState: Bundle?) {
        val string = intent?.getStringExtra(ConstUtils.VIDEO_PLAY_URL)
        string?.let { loadCoverImage(it) }
    }

    fun loadCoverImage(url: String) {
        binding.remotePlaybackWndSv.setUpLazy(url, true, null, null, "")
        binding.remotePlaybackWndSv.startPlayLogic()
        binding.remotePlaybackWndSv.backButton?.visibility = View.GONE;
    }

    override fun onPause() {
        super.onPause()
        binding.remotePlaybackWndSv.onVideoPause()
    }

}